<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <title>社交平台顶部导航集合</title>
  <!-- Bootstrap 5 CSS -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
  
  <style>
    :root {
      --primary: #3B82F6;
      --secondary: #10B981;
      --danger: #EF4444;
      --light: #F9FAFB;
      --dark: #1F2937;
      --light-gray: #E5E7EB;
      --dark-gray: #6B7280;
      --white: #FFFFFF;
      --border-light: #E5E7EB;
      --border-dark: #374151;
    }
    
    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      background-color: var(--light);
      color: var(--dark);
      height: 100vh;
      overflow-x: hidden;
      margin: 0;
      padding-top: 56px;
    }
    
    /* 页面容器 */
    .page-container {
      display: none;
      height: 100%;
    }
    
    .page-container.active {
      display: block;
    }
    
    /* 页面内容 */
    .page-content {
      padding: 20px;
      min-height: calc(100vh - 56px);
    }
    
    .page-title {
      font-size: 24px;
      font-weight: 600;
      margin-bottom: 20px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--border-light);
    }
    
    .dark .page-title {
      color: var(--white);
      border-bottom-color: var(--border-dark);
    }
    
    .scenario-description {
      background-color: rgba(59, 130, 246, 0.1);
      border-left: 4px solid var(--primary);
      padding: 12px 16px;
      margin-bottom: 20px;
      border-radius: 0 4px 4px 0;
    }
    
    .dark .scenario-description {
      background-color: rgba(59, 130, 246, 0.2);
      color: var(--white);
    }
    
    /* 顶部导航基础样式 */
    .top-nav {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 56px;
      display: flex;
      align-items: center;
      background-color: var(--white);
      border-bottom: 1px solid var(--border-light);
      z-index: 1000;
      padding: 0 16px;
    }
    
    .dark .top-nav {
      background-color: #111827;
      border-bottom-color: var(--border-dark);
    }
    
    .nav-back {
      color: var(--dark);
      background: none;
      border: none;
      font-size: 20px;
      padding: 4px;
      margin-right: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .dark .nav-back {
      color: var(--white);
    }
    
    .nav-brand {
      font-size: 20px;
      font-weight: 600;
      color: var(--primary);
      text-decoration: none;
    }
    
    .nav-title {
      font-size: 18px;
      font-weight: 600;
      margin: 0;
      flex: 1;
      text-align: center;
    }
    
    .dark .nav-title {
      color: var(--white);
    }
    
    .nav-actions {
      display: flex;
      gap: 12px;
    }
    
    .nav-action {
      color: var(--dark-gray);
      background: none;
      border: none;
      font-size: 20px;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
    }
    
    .dark .nav-action {
      color: #9CA3AF;
    }
    
    .nav-action:hover {
      background-color: var(--light-gray);
    }
    
    .dark .nav-action:hover {
      background-color: #374151;
    }
    
    /* 搜索栏样式 */
    .search-container {
      flex: 1;
      position: relative;
      margin: 0 12px;
    }
    
    .search-input {
      width: 100%;
      padding: 8px 16px 8px 40px;
      border-radius: 20px;
      border: 1px solid var(--border-light);
      background-color: var(--light);
      font-size: 14px;
    }
    
    .dark .search-input {
      background-color: #1F2937;
      border-color: var(--border-dark);
      color: var(--white);
    }
    
    .search-icon {
      position: absolute;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--dark-gray);
    }
    
    /* 标签页导航 */
    .tabs-nav {
      height: auto;
      flex-direction: column;
      padding: 0;
    }
    
    .tabs-nav .nav-header {
      width: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 16px;
      border-bottom: 1px solid var(--border-light);
    }
    
    .dark .tabs-nav .nav-header {
      border-bottom-color: var(--border-dark);
    }
    
    .tabs-container {
      width: 100%;
      display: flex;
      overflow-x: auto;
      scrollbar-width: none;
    }
    
    .tabs-container::-webkit-scrollbar {
      display: none;
    }
    
    .tab-item {
      padding: 12px 20px;
      white-space: nowrap;
      font-size: 15px;
      font-weight: 500;
      color: var(--dark-gray);
      border-bottom: 3px solid transparent;
      cursor: pointer;
    }
    
    .dark .tab-item {
      color: #9CA3AF;
    }
    
    .tab-item.active {
      color: var(--primary);
      border-bottom-color: var(--primary);
    }
    
    /* 编辑模式导航 */
    .edit-nav .nav-title {
      text-align: left;
      margin-right: 12px;
    }
    
    .edit-nav .nav-actions {
      margin-left: auto;
    }
    
    .edit-nav .nav-action {
      font-size: 16px;
      width: auto;
      height: auto;
      border-radius: 0;
      padding: 6px 12px;
    }
    
    .edit-nav .nav-action.primary {
      color: var(--primary);
      font-weight: 500;
    }
    
    /* 深色模式 */
    .dark {
      background-color: var(--dark);
      color: var(--white);
    }
    
    /* 通知徽章 */
    .badge {
      position: absolute;
      top: 2px;
      right: 2px;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background-color: var(--danger);
      color: white;
      font-size: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    /* 场景切换器 */
    .scenario-switcher {
      position: fixed;
      top: 70px;
      right: 16px;
      z-index: 1001;
      background-color: white;
      border-radius: 8px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
      overflow: hidden;
      max-height: 70vh;
      overflow-y: auto;
    }
    
    .dark .scenario-switcher {
      background-color: #1F2937;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }
    
    .switcher-header {
      padding: 8px 12px;
      font-size: 14px;
      font-weight: 500;
      border-bottom: 1px solid var(--border-light);
    }
    
    .dark .switcher-header {
      border-bottom-color: var(--border-dark);
      color: var(--white);
    }
    
    .scenario-option {
      padding: 10px 16px;
      font-size: 14px;
      cursor: pointer;
    }
    
    .scenario-option:hover {
      background-color: var(--light);
    }
    
    .dark .scenario-option {
      color: var(--white);
    }
    
    .dark .scenario-option:hover {
      background-color: #374151;
    }
    
    .scenario-option.active {
      background-color: var(--primary);
      color: white;
    }
  </style>
</head>
<body>
  <!-- 场景切换器 -->
  <div class="scenario-switcher">
    <div class="switcher-header">顶部导航场景</div>
    <div class="scenario-option active" data-scenario="home">首页导航</div>
    <div class="scenario-option" data-scenario="detail">详情页导航</div>
    <div class="scenario-option" data-scenario="search">搜索页导航</div>
    <div class="scenario-option" data-scenario="tabs">标签页导航</div>
    <div class="scenario-option" data-scenario="edit">编辑页导航</div>
    <div class="scenario-option" data-scenario="profile">个人页导航</div>
    <div class="scenario-option" data-scenario="notifications">通知页导航</div>
    <div class="scenario-option" data-scenario="settings">设置页导航</div>
    <div class="scenario-option" data-scenario="dark">深色模式导航</div>
  </div>
  
  <!-- 1. 首页导航 -->
  <div class="page-container active" id="homePage">
    <nav class="top-nav">
      <a href="#" class="nav-brand">Social</a>
      <div class="nav-actions">
        <button class="nav-action" aria-label="搜索">
          <i class="fa fa-search"></i>
        </button>
        <button class="nav-action" aria-label="消息">
          <i class="fa fa-bell"></i>
          <span class="badge">3</span>
        </button>
        <button class="nav-action" aria-label="创建">
          <i class="fa fa-plus-square-o"></i>
        </button>
      </div>
    </nav>
    
    <div class="page-content">
      <h1 class="page-title">首页</h1>
      <div class="scenario-description">
        <strong>场景特点：</strong> 展示品牌标识，提供核心功能入口，适合应用的主页面。右侧包含搜索、通知和创建内容按钮，通知带有未读数量提示。
      </div>
      <p>首页内容区域展示用户关注的动态、推荐内容等</p>
    </div>
  </div>
  
  <!-- 2. 详情页导航 -->
  <div class="page-container" id="detailPage">
    <nav class="top-nav">
      <button class="nav-back" aria-label="返回">
        <i class="fa fa-arrow-left"></i>
      </button>
      <h1 class="nav-title">帖子详情</h1>
      <div class="nav-actions">
        <button class="nav-action" aria-label="分享">
          <i class="fa fa-share-alt"></i>
        </button>
        <button class="nav-action" aria-label="更多">
          <i class="fa fa-ellipsis-v"></i>
        </button>
      </div>
    </nav>
    
    <div class="page-content">
      <h1 class="page-title">帖子详情</h1>
      <div class="scenario-description">
        <strong>场景特点：</strong> 左侧有返回按钮，中间显示当前页面标题，右侧提供操作按钮，适合内容详情页、用户资料页等需要返回上级的页面。
      </div>
      <p>这里展示帖子的详细内容、作者信息和评论区</p>
    </div>
  </div>
  
  <!-- 3. 搜索页导航 -->
  <div class="page-container" id="searchPage">
    <nav class="top-nav">
      <button class="nav-back" aria-label="返回">
        <i class="fa fa-arrow-left"></i>
      </button>
      <div class="search-container">
        <i class="fa fa-search search-icon"></i>
        <input type="text" class="search-input" placeholder="搜索用户、话题或内容...">
      </div>
      <button class="nav-action" aria-label="取消">
        <i class="fa fa-times"></i>
      </button>
    </nav>
    
    <div class="page-content">
      <h1 class="page-title">搜索结果</h1>
      <div class="scenario-description">
        <strong>场景特点：</strong> 突出搜索功能，搜索框占据主要位置，适合搜索页面。左侧有返回按钮，右侧有取消按钮，方便用户快速退出搜索状态。
      </div>
      <p>这里显示与搜索关键词相关的结果列表</p>
    </div>
  </div>
  
  <!-- 4. 标签页导航 -->
  <div class="page-container" id="tabsPage">
    <nav class="top-nav tabs-nav">
      <div class="nav-header">
        <a href="#" class="nav-brand">动态</a>
        <div class="nav-actions">
          <button class="nav-action" aria-label="筛选">
            <i class="fa fa-filter"></i>
          </button>
        </div>
      </div>
      <div class="tabs-container">
        <div class="tab-item active">关注</div>
        <div class="tab-item">推荐</div>
        <div class="tab-item">热门</div>
        <div class="tab-item">最新</div>
        <div class="tab-item">附近</div>
        <div class="tab-item">话题</div>
      </div>
    </nav>
    
    <div class="page-content">
      <h1 class="page-title">关注的动态</h1>
      <div class="scenario-description">
        <strong>场景特点：</strong> 双层结构，上层为导航元素，下层为可横向滑动的标签页，适合内容分类浏览页面。标签支持左右滑动，可容纳多个分类选项。
      </div>
      <p>这里显示用户关注的人发布的最新动态</p>
    </div>
  </div>
  
  <!-- 5. 编辑页导航 -->
  <div class="page-container" id="editPage">
    <nav class="top-nav edit-nav">
      <button class="nav-back" aria-label="返回">
        <i class="fa fa-arrow-left"></i>
      </button>
      <h1 class="nav-title">发布帖子</h1>
      <div class="nav-actions">
        <button class="nav-action" aria-label="草稿">
          草稿
        </button>
        <button class="nav-action primary" aria-label="发布">
          发布
        </button>
      </div>
    </nav>
    
    <div class="page-content">
      <h1 class="page-title">发布帖子</h1>
      <div class="scenario-description">
        <strong>场景特点：</strong> 突出操作按钮，右侧有功能性文字按钮，适合内容编辑、发布、设置等需要明确操作按钮的页面。
      </div>
      <p>这里是内容编辑区域，用户可以输入文字、上传图片等</p>
    </div>
  </div>
  
  <!-- 6. 个人页导航 -->
  <div class="page-container" id="profilePage">
    <nav class="top-nav">
      <button class="nav-back" aria-label="返回">
        <i class="fa fa-arrow-left"></i>
      </button>
      <h1 class="nav-title">李小明的主页</h1>
      <div class="nav-actions">
        <button class="nav-action" aria-label="消息">
          <i class="fa fa-envelope-o"></i>
        </button>
        <button class="nav-action" aria-label="更多">
          <i class="fa fa-ellipsis-v"></i>
        </button>
      </div>
    </nav>
    
    <div class="page-content">
      <h1 class="page-title">个人主页</h1>
      <div class="scenario-description">
        <strong>场景特点：</strong> 中间显示用户名称，提供与该用户相关的操作入口，适合个人主页、用户资料页等。右侧通常包含消息和更多操作按钮。
      </div>
      <p>这里显示用户的个人信息、发布的内容和互动数据</p>
    </div>
  </div>
  
  <!-- 7. 通知页导航 -->
  <div class="page-container" id="notificationsPage">
    <nav class="top-nav">
      <button class="nav-back" aria-label="返回">
        <i class="fa fa-arrow-left"></i>
      </button>
      <h1 class="nav-title">通知</h1>
      <div class="nav-actions">
        <button class="nav-action" aria-label="设置">
          <i class="fa fa-cog"></i>
        </button>
      </div>
    </nav>
    
    <div class="page-content">
      <h1 class="page-title">通知中心</h1>
      <div class="scenario-description">
        <strong>场景特点：</strong> 专注于通知内容展示，右侧提供通知设置入口，适合通知列表、消息中心等页面。
      </div>
      <p>这里显示用户收到的所有通知，包括点赞、评论、关注等</p>
    </div>
  </div>
  
  <!-- 8. 设置页导航 -->
  <div class="page-container" id="settingsPage">
    <nav class="top-nav">
      <button class="nav-back" aria-label="返回">
        <i class="fa fa-arrow-left"></i>
      </button>
      <h1 class="nav-title">设置</h1>
      <div class="nav-actions">
        <button class="nav-action" aria-label="帮助">
          <i class="fa fa-question-circle-o"></i>
        </button>
      </div>
    </nav>
    
    <div class="page-content">
      <h1 class="page-title">设置页面</h1>
      <div class="scenario-description">
        <strong>场景特点：</strong> 简洁的设置页面导航，右侧通常提供帮助或支持入口，适合各类设置页面。
      </div>
      <p>这里显示应用的各种设置选项，如账号、隐私、通知等</p>
    </div>
  </div>
  
  <!-- 9. 深色模式导航 -->
  <div class="page-container dark" id="darkPage">
    <nav class="top-nav">
      <a href="#" class="nav-brand">Social</a>
      <div class="nav-actions">
        <button class="nav-action" aria-label="搜索">
          <i class="fa fa-search"></i>
        </button>
        <button class="nav-action" aria-label="消息">
          <i class="fa fa-bell"></i>
          <span class="badge">3</span>
        </button>
        <button class="nav-action" aria-label="创建">
          <i class="fa fa-plus-square-o"></i>
        </button>
      </div>
    </nav>
    
    <div class="page-content">
      <h1 class="page-title">深色模式首页</h1>
      <div class="scenario-description">
        <strong>场景特点：</strong> 深色背景搭配浅色文字和图标，降低夜间使用的视觉疲劳，适合所有页面在低光环境下使用。
      </div>
      <p>首页内容区域展示用户关注的动态、推荐内容等</p>
    </div>
  </div>
  
  <!-- Bootstrap JS -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
  
  <script>
    // 获取DOM元素
    const scenarioOptions = document.querySelectorAll('.scenario-option');
    const pageContainers = document.querySelectorAll('.page-container');
    const tabItems = document.querySelectorAll('.tab-item');
    const navActions = document.querySelectorAll('.nav-action, .nav-back');
    
    // 当前激活的场景
    let currentScenario = 'home';
    
    // 切换导航场景
    scenarioOptions.forEach(option => {
      option.addEventListener('click', function() {
        // 更新场景选项的活跃状态
        scenarioOptions.forEach(opt => opt.classList.remove('active'));
        this.classList.add('active');
        
        // 获取选中的场景
        currentScenario = this.getAttribute('data-scenario');
        
        // 隐藏所有页面
        pageContainers.forEach(page => page.classList.remove('active'));
        
        // 显示对应场景的页面
        const scenarioPage = document.getElementById(`${currentScenario}Page`);
        if (scenarioPage) {
          scenarioPage.classList.add('active');
        }
      });
    });
    
    // 标签页切换
    tabItems.forEach(tab => {
      tab.addEventListener('click', function() {
        // 移除所有标签的活跃状态
        tabItems.forEach(item => item.classList.remove('active'));
        
        // 添加当前标签的活跃状态
        this.classList.add('active');
        
        // 更新页面内容
        const activePage = document.querySelector('.page-container.active');
        if (activePage) {
          const pageTitleElement = activePage.querySelector('.page-title');
          if (pageTitleElement) {
            pageTitleElement.textContent = `${this.textContent}的动态`;
          }
        }
      });
    });
    
    // 导航操作按钮点击事件
    navActions.forEach(action => {
      action.addEventListener('click', function() {
        let actionName = '';
        
        if (this.classList.contains('nav-back')) {
          actionName = '返回';
        } else {
          const icon = this.querySelector('i');
          if (icon) {
            if (icon.classList.contains('fa-search')) actionName = '搜索';
            else if (icon.classList.contains('fa-bell')) actionName = '通知';
            else if (icon.classList.contains('fa-plus-square-o')) actionName = '创建内容';
            else if (icon.classList.contains('fa-share-alt')) actionName = '分享';
            else if (icon.classList.contains('fa-ellipsis-v')) actionName = '更多选项';
            else if (icon.classList.contains('fa-times')) actionName = '取消搜索';
            else if (icon.classList.contains('fa-filter')) actionName = '筛选';
            else if (icon.classList.contains('fa-envelope-o')) actionName = '发送消息';
            else if (icon.classList.contains('fa-cog')) actionName = '设置';
            else if (icon.classList.contains('fa-question-circle-o')) actionName = '帮助';
          } else if (this.textContent.trim() === '草稿') {
            actionName = '保存草稿';
          } else if (this.textContent.trim() === '发布') {
            actionName = '发布内容';
          }
        }
        
        alert(`执行${actionName}操作`);
      });
    });
  </script>
</body>
</html>